package Arrays;

import java.util.Arrays;

public class _766_ToeplitzMatrix {
    public boolean isToeplitzMatrix(int[][] matrix) {
        int length1D = matrix.length;
        int length2D = matrix[0].length;
        int[] tempNum = Arrays.copyOf(matrix[0],length2D);
        for(int i=1;i<length1D;i++){
            for(int j=0;j<length2D-1;j++){
                if(matrix[i][j+1]!=tempNum[j]){
                    return false;
                }
            }
            tempNum = Arrays.copyOf(matrix[i],length2D);
        }
        return true;
    }
}
